using System;
using System.Collections.Generic;
using System.Text;

namespace tKitchen
{
    public class Recipe_Ingredient
    {
        int recipeIngredientId;
        Ingredient ingredient;
        double amount;
        Unit unit;

        #region Properties
        public int Recipe_IngredientId
        {
            get { return recipeIngredientId; }
            set { recipeIngredientId = value; }
        }
        public Ingredient Ingredient
        {
            get { return ingredient; }
            set { ingredient = value; }
        }

        public double Amount
        {
            get { return amount; }
            set { amount = value; }
        }


        public Unit Unit
        {
            get { return unit; }
            set { unit = value; }
        }
        #endregion

        public Recipe_Ingredient()
        {
            recipeIngredientId = -1;
        }
        public Recipe_Ingredient(Recipe_IngredientPO poIn)
        {
            recipeIngredientId = poIn.Recipe_IngredientId;
            ingredient = new Ingredient(poIn.Ingredient);
            amount = poIn.Amount;
            if (poIn.Unit != null)
            {
                unit = new Unit(poIn.Unit);
            }
            else
            {
                unit = null;
            }
        }

        public override string ToString()
        {
            return this.amount + " " + this.unit + " " + this.ingredient;
        }


        internal Recipe_Ingredient Copy()
        {
            Recipe_Ingredient temp = new Recipe_Ingredient();
            temp.Amount = this.Amount;
            if (this.ingredient != null)
            {
                temp.Ingredient = this.Ingredient.Copy();
            }

            temp.Recipe_IngredientId = this.Recipe_IngredientId;

            if (this.unit != null)
            {
                temp.Unit = this.Unit.Copy();
            }

            return temp;
        }
    }
}
